package com.qying.myguava.util;

import java.util.Objects;

public interface MyIterator<E> {

    boolean hasNext();

    E next();

    default void remove(){
        throw new UnsupportedOperationException();
    }

    default void forEachRemaining(MyConsumer<? super E> action) {
        Objects.requireNonNull(action);
        while (hasNext()) {
            action.accept(next());
        }
    }
}
